class MailReaderJob {

  def startDelay = 90001 // wait 1.5 minute before starting feed syndication
  def timeout = 60000l // execute job once in 60 seconds
  def concurrent = false

  private static updating = false
  def mailReaderService

  def execute() {
    if (!updating) {
      updating = true
      log.info "Collecting Messages from email..."
      mailReaderService.getEMails()
      updating = false
    } else {
      log.warn("Skipping Mail collection. Previous job in progress")
    }
  }
}
